// src/main/java/com/example/coursehub/repository/ClassesStudentRepository.java
package com.example.coursehub.repository;

import com.example.coursehub.entity.ClassesStudent;
import com.example.coursehub.entity.ClassesStudentId; 
import com.example.coursehub.entity.Classes;
import com.example.coursehub.entity.User; 
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;
import java.util.Optional;


public interface ClassesStudentRepository extends JpaRepository<ClassesStudent, ClassesStudentId>, JpaSpecificationExecutor<ClassesStudent> {

    Optional<ClassesStudent> findByClasses_ClassesIdAndUser_UserId(String classesId, String userId);

    List<ClassesStudent> findByClasses(Classes classes);

    void deleteByClasses_ClassesIdAndUser_UserId(String classesId, String userId);

    List<ClassesStudent> findByUser(User user);

    Optional<ClassesStudent> findByUser_UserId(String userId);

    List<ClassesStudent> findByClasses_ClassesId(String classesId);
}